<template>
	<eui-page-frame topHeight="66" :bottomHeight="0">
		<template #top>
			<view class="content-img">
				<eui-nav-bar title="详情" color="#000000" rightIcon="" />
			</view>
		</template>
		<eui-page-content>
			<eui-base-card :title="info.c_title">
				<eui-detail-show :items="dataItems" v-model="info" :colon=true size="normal"
					labelWidth="50px"></eui-detail-show>
			</eui-base-card>
			<scroll-view scroll-y :style="{width:scrollWidth}" style="height: 600px;background-color: #fff;border-radius: 0.625rem;padding: 10px;" class="margin-top-28">
				<view class="email-html" style="overflow-y: auto;" v-html="c_html" v-if="info.c_type=='在线编辑'">
				</view>
				<iframe :src="c_html" style="width:100%;height: 100%;border:0px;overflow: auto;" id="iframe"
					v-else></iframe>
			</scroll-view>
			<!-- <scroll-view scroll-y style="width: 100%;height: 1000px;" class="margin-top-28">
				<iframe :src="c_html"
					style="width:100%;height: 100%;border:0px;overflow: auto;"
					id="iframe"></iframe>
			</scroll-view> -->
			<!-- <eui-base-card style="height: 85%;" title="">
				<iframe :src="c_html"
					style=" width:100%;height: 100%;border:0px;-webkit-overflow-scrolling:touch;overflow:scroll;overflow-x : hidden; "
					id="iframe"></iframe>
			</eui-base-card> -->
		</eui-page-content>
	</eui-page-frame>
</template>
<script setup type="ts">
	import { onLoad,onReady } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	import Enjoy from '@/common/enjoy';
	import service from '@/common/service';
	import { useMainStore } from '@/store/modules/store';
	import { useLoginStore } from '@/store/modules/useLoginStore';
	import Guid from '@/common/guid';
	import dateRangUtil from '@/common/dateRangUtil';
	const mainStore = useMainStore();
	const LoginStore = useLoginStore();
	const scrollWidth = ref((uni.getSystemInfoSync().windowWidth-40) + 'px');
	const scrollHeight = ref((uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight-114) + 'px');
	const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight);
	const info = ref({});
	const c_html=ref('');
	const accessoryList = ref([]);
	const onTapLeft = () =>{
		uni.navigateBack();
	}
	const dataItems = [
	{
			label: "发布人",
			prop: "c_mk_username",
			type: "text",
			colSpan: 12,
			element: {
			},
		},
		{
			label: "发布日期",
			prop: "c_mk_dt",
			type: "text",
			colSpan: 12,
			element: {
				mode: "YYYY-MM-DD",
			},
		}
	]
	// 获取内容
	const DocGetContent = () =>{
		service.enjoyShowLoading('正在加载...');
		let request = {
		    url: LoginStore.EnjoyMain,
		    data: {
		        UniqueKey: "管易通40公共",
		        ObjectData: info.value.c_guid+'info',
		        MethodName: "DocGetContent",
		    },
		}
		service.request(request, (res) => {
		    if (res && res.data) {
		        if (!res.data.HasException) {
					const ObjectData = res.data.ObjectData;
					c_html.value = ObjectData;
		        } else {
		            service.enjoyShowToast(res.data.Exception.Message)
		        }
		    }
			service.enjoyHideLoading();
		}, () => {
			service.enjoyHideLoading();
		    console.log('失败')
		});
	}
	onLoad((e)=>{	
		var url=LoginStore.EnjoyMain;
		console.log('传过来了:'+url);	
		info.value={...JSON.parse(e.data)};
		console.log(" info.value: " + JSON.stringify(info.value));
		if(info.value.c_type=='在线编辑'){
			DocGetContent();
			// c_html.value=url.replace('/Enjoy/Service','/FILE/getcontent/')+info.value.c_guid+'info';
		}
		else{
			c_html.value=info.value.c_link;
		}
	})
</script>

<style lang="scss" scoped>
	@import '@/main.scss';

	.content-img {
		background-color: #FFFFFF;
		background-repeat: no-repeat;
		width: 100%;
	}

	.main-view {
		flex: 1;
		flex-direction: column;
		background-color: #f2f2f2;
		font-size: 14px;
	}

	.font-size-36 {
		font-size: 36rpx;
	}

	.font-size-26 {
		font-size: 26rpx;
	}

	.font-weight-bold {
		font-weight: bold;
	}

	.padding-all-20 {
		padding: 20rpx;
	}

	.padding-all-28 {
		padding: 28rpx;
	}

	.background-color-fff {
		background-color: #fff;
	}

	.border-radius-20 {
		border-radius: 20rpx;
	}

	.flex {
		display: flex;
	}

	.flex-direction-column {
		flex-direction: column !important;
	}

	.text-align-right {
		text-align: right;
	}

	.color-888 {
		color: #888;
	}

	.padding-right-16 {
		padding-right: 16rpx;
	}

	.margin-top-28 {
		margin-top: 28rpx;
	}

	.line-height-1 {
		line-height: 1;
	}

	.margin-top-16 {
		margin-top: 16rpx;
	}

	.padding-bottom-28 {
		padding-bottom: 28rpx;
	}

	.border-bottom-eee {
		border-bottom: solid 1px #eee;
	}

	.attachment-list {
		height: 55px;
		border-radius: 10px;
		background-color: rgba(249, 249, 248, 1);
		margin-bottom: 10px;
		padding: 0 10px;
		font-size: 14px;
	}

	.align-items-center {
		align-items: center;
	}

	.align-items-flex-start {
		align-items: flex-start;
	}

	.justify-content-center {
		justify-content: center;
	}

	.margin-left-30 {
		margin-left: 30rpx;
	}

	.font-size-24 {
		font-size: 24rpx;
	}

	.margin-top-10 {
		margin-top: 10rpx;
	}

	.user-footer {
		position: fixed;
		z-index: 9;
		bottom: 0;
		left: 0;
		right: 0;
		height: 108rpx;
		background-color: #fff;
		display: flex;
		align-items: center;
		padding: 0 20rpx;
	}

	.recover-email {
		width: 100rpx;
		height: 68rpx;
		background: linear-gradient(135deg, rgba(2, 183, 230, 1), rgba(54, 169, 243, 1));
		border-radius: 10rpx;
		color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.recover-input {
		height: 68rpx;
		background-color: rgba(249, 249, 248, 1);
		margin-right: 10px;
		flex: 1;
		display: flex;
		align-items: center;
	}

	.iconfont {
		font-size: 20px;
		width: 40px;
		height: 100%;
		text-align: center;
		line-height: 37px;
		@include themeText("themeText");
	}

	.ellipsis-1 {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.header-content {
		height: 88rpx;
		padding: 0 6px;
		background-color: #fff;
		align-items: center;
		position: relative;
		z-index: 2;
	}

	.justify-content-space-between {
		justify-content: space-between;
	}

	.justify-content-flex-end {
		justify-content: flex-end;
	}
</style>